export {};

interface IPerson1 {
  handsome: string;
  name: string;
}

interface IPerson2 {
  high: string;
  name: number;
}

function merge<T extends Object, K extends object>(
  a: T,
  b: K
): Omit<T, keyof K> & K {
  return { ...a, ...b };
}

let p1: IPerson1 = { handsome: "", name: "" };
let p2: IPerson2 = { high: "", name: 123 };

let r = merge(p1, p2);
r.handsome;
r.high;
r.name;

type IDiff = Omit<IPerson1, keyof IPerson2>; //排除 2在1中的重复的属性
